package com.tfswx.jcyw.sqlmodel.api.bean.table;

import lombok.Data;

import java.io.Serializable;

/**
 * @author 张述江
 * @date 2023/9/15
 */
@Data
public class SelectItem implements Serializable {
    private Expression expression;
    private Alias alias;

    public SelectItem(Expression expression, Alias alias) {
        this.expression = expression;
        this.alias = alias;
    }

    public SelectItem(Expression expression, String alias) {
        this(expression, new Alias(alias));
    }

    public SelectItem(Expression expression) {
        this(expression, (Alias) null);
    }

    public SelectItem() {
        this(null);
    }

    @Override
    public String toString() {
        return expression + ((alias != null) ? alias.toString() : "");
    }

}
